home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9982 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: solon.com!not-for-mail
  2. From: seebs@solutions.solon.com (Peter Seebach)
  3. Newsgroups: comp.sources.wanted,comp.lang.c,comp.unix.programmer
  4. Subject: Re: Seek unix2dos.c OR help with tr
  5. Date: 14 Mar 1996 14:47:15 -0600
  6. Organization: Usenet Fact Police (Undercover)
  7. Message-ID: <4ia0kj$d8s@solutions.solon.com>
  8. References: <4i0946$7io@nuke.csu.net> <danpop.826545577@rscernix> <4i9dj4INN7kl@keats.ugrad.cs.ubc.ca>
  9. NNTP-Posting-Host: solutions.solon.com
  10.  
  11. In article <4i9dj4INN7kl@keats.ugrad.cs.ubc.ca>,
  12. Kazimir Kylheku <c2a192@ugrad.cs.ubc.ca> wrote:
  13. >When I know that I'm specifically dealing with ASCII control chars, I have a
  14. >macro like:
  15.  
  16. >#define CTRL(C) ((C)-64)
  17.  
  18. >which I then use with capital letters:
  19.  
  20. >    switch(char) {
  21. >    case CTRL('M'):
  22.  
  23. I always use
  24.     #define CTRL(x) ((x) & 0x1f)
  25.  
  26. because this preserves the likely semantics of CTRL.
  27.  
  28. -s
  29. -- 
  30. Peter Seebach - seebs@solon.com - Copyright 1996 Peter Seebach.
  31. C/Unix wizard -- C/Unix questions? Send mail for help.  No, really!
  32. FUCK the communications decency act.  Goddamned government.  [literally.]
  33. The *other* C FAQ - http://www.solon.com/~seebs/c/c-iaq.html
  34.